<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>函数</title>
</head>
<body>
	<script>
	//金字塔
		function jinzita(z){
			var i,n,j;
		for(n=1;n<=z;n++){
			for(j=0;j<z-n;j++){
				document.write('-');
			}
		    for(i=1;i<=(2*n-1);i++){

			document.write('*');
		    }
		document.write('</br>');
		}
		}
		jinzita(20);
	//求数组的最大值
	     function arrmax(arr){
		var i,max=arr[0];
		for(i=0;i<arr.length;i++){
			if(max<arr[i]){
				max=arr[i];
			}
		}
		document.write(max);
		document.write('<br>');
	     }
	     arrmax([23,56,78,59,90,38,76,87,98,39]);
	//一维数组排序
	   function arrpaixu(arr1){
	   	var i,temp;
		for(i=0;i<arr1.length;i++){
			for(var j=i+1;j<arr1.length;j++){
				if(arr1[i]<arr1[j]){
					temp=arr1[i];
					arr1[i]=arr1[j];
					arr1[j]=temp;
				}
			}
		}
		document.write(arr1);
	   }
	   arrpaixu([30,40,39,88,22,76,32,78,45,64]);
	//二维数组求最大值
	    function arr2max(arr2){
	    	var i,j,max=arr2[0][0];
	    for(i=0;i<arr2.length;i++){
	   	for(j=0;j<arr2[i].length;j++){
	   		if(arr2[i][j]>max){
	   			max=arr2[i][j];
	   		}
	   	}
	   }
	   document.write('<br>'+max);
	    }

        arr2max([
	          [45,78,90],
	          [36,98,23],
	          [16,89,36]
	   ]);
	</script>
</body>
</html>